package company.shopee_F;

import java.util.*;

public class Shopee03 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        List<Integer> list1 = new ArrayList<>();
        List<Integer> list2 = new ArrayList<>();
        String[] array = str1.split("\\*");

        String part1 = array[0];
        String part2 = array[1];
        int part1Length = part1.length();
        int part2Length = part2.length();
        int lastIndex1 = str2.length() - (part1.length() + part2.length());
        int lastIndex2 = str2.length() - part2.length();
        for (int i = 0; i <= lastIndex1; i++) {
            for (int j = i + part1Length; j <= lastIndex2; j++) {
                if (part1.equals(str2.substring(i, i + part1Length)) && part2.equals(str2.substring(j, j + part2Length))) {
                    list1.add(i);
                    list2.add(j - i + part2Length);
                }
            }
        }
        if (list1.size() == 0)
            System.out.println(-1 + " " + 0);
        else {
            for (int i = 0; i < list1.size(); i++) {
                System.out.println(list1.get(i) + " " + list2.get(i));
            }
        }
    }
}
